#include <SFML/Graphics.hpp>
#include <set>
#include "ManagerBase.h"

#include "../Data/Node.h"

class WindowManager;
class EntityManager;

class LevelManager : ManagerBase
{
public:
	LevelManager();
	~LevelManager();

	void Setup();

	void Tick(float DeltaTime);
	void DrawNode(int nodeID);
	void DrawConnection(int node1, int node2);

	float GetPlayAreaX(float X);
	float GetPlayAreaY(float Y);

	void BeginGame();
	void LoadLevel(sf::String levelName);

	Node* GetNode(int NodeID);

private:
	void split(const std::string& str, std::vector<std::string>& v);

	int AddNode(float x, float y);
	void AddConnection(int from, int to, Node::Direction dir);

	WindowManager* m_pWindowManager;
	EntityManager* m_pEntityManager;

	sf::String m_currentLevel;
	Node* m_pRootNode;
	std::map<int, Node*> m_nodeLookup;

	std::set<Node*> m_processedNodes;
};